<?php session_start();?>
<head><script src='https://www.google.com/recaptcha/api.js'></script></head>
<h1>Inscription</h1>
<div class="cadreContenu">
	<h3>Le formulaire d'inscription</h3>	
	<form  id="formInscription" method="post" action="pages/contenu/inscription/inscription.php">
	
		<table class="tableForm">
			<tr>
				<td><label for="civilite">Civilité</label></td>
				<td><select required id="civilite" name="civilite">
				<?php 
				if(isset($_SESSION['inputs']['civilite'])){
					if($_SESSION['inputs']['civilite']=="Mr"){
				?>
					<option selected value="Mr">Monsieur</option> 
	  				<option value="Mme">Madame</option>
				<?php 
					}else{
				?>
					<option value="Mr">Monsieur</option> 
	  				<option selected value="Mme">Madame</option>
	  			<?php 
	  				}
	  			}else{
	  			?>	
	  				<option value="Mr">Monsieur</option> 
	  				<option value="Mme">Madame</option>
	  			<?php 
	  			}
	  			?>
					</select>
				</td>
				<td><label for="loginInscri">Identifiant</label></td>
				<td>
					<input maxlength="25" onChange="return checkLogin();" id="loginInscri" name="loginInscri" type="text" required placeholder="votre identifiant" title="Saisissez votre identifiant" value="<?php echo isset($_SESSION['inputs']['loginInscri']) ? $_SESSION['inputs']['loginInscri'] : ""?>"/>			
				</td>		
			</tr>
			<tr>
				<td><label for="nom">Nom</label></td>
				<td><input maxlength="50" id="nom" name="nom" type="text" required placeholder="votre nom" title="Saisissez votre nom" value="<?php echo isset($_SESSION['inputs']['nom']) ? $_SESSION['inputs']['nom'] : ""?>"/></td>
				<td><label for="passwordInscri">Mot de passe</label></td>
				<td><input maxlength="64" onChange="return checkMdpSize();" id="passwordInscri" name="passwordInscri" type="password" required placeholder="votre mot de passe" title="Saisissez votre mot de passe" value="<?php echo isset($_SESSION['inputs']['passwordInscri']) ? $_SESSION['inputs']['passwordInscri'] : ""?>"/></td>
				
			</tr>
			<tr>
				<td><label for="prenom">Prénom</label></td>
				<td><input maxlength="50" id="prenom" name="prenom" type="text" required placeholder="votre prénom" title="Saisissez votre prénom" value="<?php echo isset($_SESSION['inputs']['prenom']) ? $_SESSION['inputs']['prenom'] : ""?>"/></td>
				<td><label for="mail">Mail</label></td>
				<td><input maxlength="200" onChange="return checkMail();" id="mail" name="mail" type="email" required placeholder="votre adresse mail" title="Saisissez votre adresse mail" value="<?php echo isset($_SESSION['inputs']['mail']) ? $_SESSION['inputs']['mail'] : ""?>"/></td>
				
			</tr>
			<tr>
				<td><label for="ville">Ville</label></td>
				<td><input maxlength="150" id="ville" name="ville" type="text" required placeholder="votre ville" title="Saisissez votreville" value="<?php echo isset($_SESSION['inputs']['ville']) ? $_SESSION['inputs']['ville'] : ""?>"/></td>
				<td><label for="telephone">Téléphone</label></td>
				<td><input id="telephone" name="telephone" type="tel" required placeholder="votre numéro de téléphone " title="Saisissez votre numéro de téléphone" pattern="^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$" value="<?php echo isset($_SESSION['inputs']['telephone']) ? $_SESSION['inputs']['telephone'] : ""?>"/></td>
			</tr>
			<tr>
				<td><label maxlength="150" for="adresse">Adresse</label></td>
				<td><input id="adresse" name="adresse" type="text" required placeholder="votre adresse " title="Saisissez votre adresse" value="<?php echo isset($_SESSION['inputs']['adresse']) ? $_SESSION['inputs']['adresse'] : ""?>"/></td>
				<td colspan="2">
	   						<input title="Cocher pour s'abonner" id="checkNews" name="newsLetter" class="css-checkbox" type="checkbox" />
							<label for="checkNews" class="css-label">S'abonner à notre newsLetter</label>
				</td>
				
			</tr>
			<tr>
				<td><label for="cp">Code Postal</label></td>
				<td><input max="99999" id="cp" name="cp" type="number" required placeholder="votre code postal " title="Saisissez votre code postal" value="<?php echo isset($_SESSION['inputs']['cp']) ? $_SESSION['inputs']['cp'] : ""?>"/></td>
				<td colspan="2">
					<div class="g-recaptcha" data-sitekey="6LdG9QATAAAAADka8O99SPykmCUhclikPt2xDjWT"></div>
				</td>
			</tr>
			<tr>
				<td colspan="2"><input id="btnInscriSubmit" value="Valider" title="Valider l'inscription" type="submit" class="inputAction"/></td>
				<td colspan="2"><input id="btnInscriReset" value="Annuler" title="Réinitialiser" type="reset" class="inputAction"/></td>
			</tr>
		</table>
	</form>
	<div id="errorInscription" class="errorInscription">
		<table class="tableError">
			<tr>
				<td id="errorLogin"></td>
				<td id="errorMdp"></td>
				<td id="errorMail"></td>
			</tr>
		</table>
	</div>
</div>
<?php unset($_SESSION['inputs']);?>